package com.springcloud.sc.ucpv5.client.util;

import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortUtil {

    /**
     * 
     */
    public static List sortListByChina(List list) {
	// 排序// 排序
	Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
	// 枚举根据描述进行排序

	return sortList(list, cmp);
    }

    public static List sortListByDesc(List list) {
	Comparator cmp = new Comparator() {
	    public int compare(Object arg0, Object arg1) {
		try {
		    String desc_0 = arg0.toString();
		    String desc_1 = arg1.toString();

		    return desc_0.compareTo(desc_1);

		} catch (Exception e) {
		    // TODO: handle exception
		}
		return 0;
	    }

	};

	return sortList(list, cmp);
    }

    public static List sortList(List list, Comparator cmp) {
	// 排序// 排序
	try {
	    Collections.sort(list, cmp);
	} catch (Exception e) {
	    e.printStackTrace();

	}
	return list;
    }

}
